package com.yc.api.d1104;

import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Spinner;

public class MyDialog extends Dialog {

	protected Object result;
	protected Shell shell;
	private Text text;
	private Text text_1;

	/**
	 * Create the dialog.
	 * @param parent
	 * @param style
	 */
	public MyDialog(Shell parent, int style) {
		super(parent, style);
		setText("SWT Dialog");
	}

	/**
	 * Open the dialog.
	 * @return the result
	 */
	public Object open() {
		createContents();
		shell.open();
		shell.layout();
		Display display = getParent().getDisplay();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		return result;
	}

	/**
	 * Create contents of the dialog.
	 */
	private void createContents() {
		shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.PRIMARY_MODAL);
		shell.setSize(406, 333);
		shell.setText("个人信息");
		
		Label label = new Label(shell, SWT.NONE);
		label.setBounds(50, 26, 61, 17);
		label.setText("用户名:");
		
		text = new Text(shell, SWT.BORDER);
		text.setBounds(117, 23, 238, 23);
		
		Label lblNewLabel = new Label(shell, SWT.NONE);
		lblNewLabel.setBounds(50, 58, 61, 17);
		lblNewLabel.setText("密码:");
		
		text_1 = new Text(shell, SWT.BORDER | SWT.PASSWORD);
		text_1.setBounds(117, 55, 238, 23);
		
		Label label_1 = new Label(shell, SWT.NONE);
		label_1.setBounds(50, 95, 61, 17);
		label_1.setText("学历:");
		
		Button button = new Button(shell, SWT.RADIO);
		button.setBounds(117, 95, 54, 17);
		button.setText("高中");
		
		Button button_1 = new Button(shell, SWT.RADIO);
		button_1.setBounds(182, 95, 54, 17);
		button_1.setText("专科");
		
		Button button_2 = new Button(shell, SWT.RADIO);
		button_2.setBounds(248, 95, 97, 17);
		button_2.setText("本科");
		
		Button btnCheckButton = new Button(shell, SWT.CHECK);
		btnCheckButton.setBounds(117, 128, 69, 17);
		btnCheckButton.setText("读书沙龙");
		
		Label label_2 = new Label(shell, SWT.NONE);
		label_2.setBounds(50, 128, 61, 17);
		label_2.setText("社团:");
		
		Button button_3 = new Button(shell, SWT.CHECK);
		button_3.setBounds(192, 128, 54, 17);
		button_3.setText("滑板");
		
		Button button_4 = new Button(shell, SWT.CHECK);
		button_4.setBounds(248, 128, 98, 17);
		button_4.setText("游戏");
		
		Combo combo = new Combo(shell, SWT.NONE);
		combo.setItems(new String[] {"湖南", "湖北"});
		combo.setBounds(117, 154, 238, 25);
		
		Label label_3 = new Label(shell, SWT.NONE);
		label_3.setBounds(50, 157, 61, 17);
		label_3.setText("籍贯:");
		
		Spinner spinner = new Spinner(shell, SWT.BORDER);
		spinner.setBounds(117, 195, 238, 23);
		
		Label lblNewLabel_1 = new Label(shell, SWT.NONE);
		lblNewLabel_1.setBounds(50, 198, 61, 17);
		lblNewLabel_1.setText("工资:");
		
		Button button_5 = new Button(shell, SWT.NONE);
		button_5.setBounds(275, 240, 80, 27);
		button_5.setText("取消");
		
		Button button_5_1 = new Button(shell, SWT.NONE);
		button_5_1.setText("保存");
		button_5_1.setBounds(192, 240, 80, 27);
		
		
		// swt 的 样式 style 的位运算规则
		// 0000001  border
		// 0000010  password
		// 0000011  border + password  或运算
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		

	}
}
